package leetcode_day._2021._202106._0110;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/6/10 7:19
 *  零钱兑换 II
 *  算法：完全背包
 */
public class _10_518 {

    public int change(int amount, int[] coins) {
        int[] dp = new int[amount + 1];
        dp[0] = 1;
        for (int i = 0; i < coins.length; i++) {
            int coin = coins[i];
            for (int j = 1; j <= amount; j++) {
                if (j >= coin) dp[j] += dp[j - coin];
            }
        }
        return dp[amount];
    }

}
